<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Emigrated extends Model
{
    use HasFactory;

    protected $fillable = ['user_id', 'category_id', 'subject_id', 'total', 'fraction', 'status'];

    protected $casts = [
        'created_at' => 'date:Y-m-d H:i:s'
    ];

    public function category()
    {
        return $this->belongsTo(Category::class,'category_id','id');
    }

    public function subject()
    {
        return $this->belongsTo(Category::class,'subject_id','id');
    }

    public function user()
    {
        return $this->belongsTo(User::class,'user_id','id');
    }
}
